package st.business.tepth.business.history;

import android.app.Dialog;
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import st.business.tepth.R;
import st.business.tepth.business.bean.HistoryResultBean;
import st.business.tepth.business.bean.RepairTaskBean;

/**
 * @author zhangyu
 * @date 2019/3/4
 */
public class DialogHistoryReportDetail extends Dialog {
    public DialogHistoryReportDetail(Context context,
                                     List<HistoryResultBean.RepairsBean> list) {
        super(context);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        View view = LayoutInflater.from(context).
                inflate(R.layout.dialog_history_report_detail, null);
        view.findViewById(R.id.iv_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        RecyclerView recyclerView = view.findViewById(R.id.recycler_view_report_detail);
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
        recyclerView.setAdapter(new BaseQuickAdapter<HistoryResultBean.RepairsBean, BaseViewHolder>
                (R.layout.item_history_report_detail, list) {
            @Override
            protected void convert(BaseViewHolder helper, HistoryResultBean.RepairsBean item) {
                helper.setText(R.id.tv_classification, item.getClassification());
                helper.setText(R.id.tv_content, item.getContent());
            }
        });
        setContentView(view);
    }

}
